//
// Created by francklinson on 2021/11/26 AT 10:27.
// May Saint Diana bless you!
//

#include <boost/scoped_array.hpp>
#include <iostream>
/**
 * 作用域数组的析构函数使用 delete[] 操作符来释放所包含的对象。
 * 因为该操作符只能用于数组对象，所以作用域数组必须通过动态分配的数组来初始化。
 * @return
 */
int main() {
    boost::scoped_array<int> i(new int[2]);
    std::cout << i[0] << " " << i[1] << " " << i[2] << std::endl;
    *i.get() = 1;
    std::cout << i[0] << " " << i[1] << " " << i[2] << std::endl;
    i[1] = 2;
    std::cout << i[0] << " " << i[1] << " " << i[2] << std::endl;
    i.reset(new int[3]);
    std::cout << i[0] << " " << i[1] << " " << i[2] << std::endl;
}